<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>手写promise</title>
  </head>
  <body>
    <script type="module">
      import MyPromise from "./myPromise.js";
      const test = new MyPromise((resolve, reject) => {
        resolve("成功回调");
      });
      test.then(
        (res) => {
          console.log("我是微任务", res);
        },
        (err) => {
          console.log(err);
        }
      );
      console.log("我是宏任务");
    </script>
  </body>
</html>
